﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Edc.MMAssemblyManager
{
    public class AssemblyVersion
    {
        public AssemblyVersion(int major, int minor, int revision, int build)
        {
            this.Major = major;
            this.Minor = minor;
            this.Revision = revision;
            this.Build = build;
        }

        public int Major { get; set; }
        public int Minor { get; set; }
        public int Revision { get; set; }
        public int Build { get; set; }

        public AssemblyVersion NextVersion
        {
            get
            {
                var next = new AssemblyVersion(Major, Minor, Revision, Build);
                next.Build = 0;
                next.Revision++;

                if (next.Revision >= 100)
                {
                    next.Revision = 0;
                    next.Minor++;
                }

                return next;
            }
        }

        public override string ToString()
        {
            return string.Format("{0}.{1}.{2}.{3}", Major, Minor, Revision, Build);
        }
    }
}
